package cn.ydt.ydt.community.service.impl;

import cn.ydt.ydt.common.exception.YdtServiceException;
import cn.ydt.ydt.common.resful.StatusCode;
import cn.ydt.ydt.community.mapper.EnclosureSingInLocationMapper;
import cn.ydt.ydt.community.service.EnclosureSingInLocationService;
import cn.ydt.ydt.community.pojo.dto.EnclosureSingInLocationDTO;
import cn.ydt.ydt.community.pojo.vo.EnclosureSIngInLocationVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Administrator
 */
@Service
public class EnclosureSingInLocationServiceImpl implements EnclosureSingInLocationService {

    @Autowired
    EnclosureSingInLocationMapper enclosureMapper;
    @Override
    public void addEnclosure(EnclosureSingInLocationDTO enclosure) {
        if (enclosureMapper.addEnclosure(enclosure) < 1){
            throw  new YdtServiceException(StatusCode.INTERNAL_SERVER_ERROR , "新增打卡区域失败");
        }
    }

    @Override
    public EnclosureSIngInLocationVO getEnclosureInfoByCommunityId(Long communityId) {
        return enclosureMapper.getEnclosureInfoByCommunityId(communityId);
    }
}
